package com.cloud.drore.eboss.sso.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.cloud.drore.eboss.sso.base.BaseEntity;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: Function
 * @Decription: 权限
 * @CreateDate: Created in 2018/3/20 20:04
 * @Author: <a href="836327318@qq.com">吴昌益</a>
 * @Modify:
 */
@Entity
@Table(name = "shiro_function")
@Data
public class Function extends BaseEntity<Long> {

	@JsonProperty("pid")
	@JSONField(name = "pid")
	@ApiModelProperty(name = "pid", notes = "父节点id", example = "0")
	private Long pid;

	@JsonProperty("remark")
	@JSONField(name = "remark")
	@ApiModelProperty(name = "remark", notes = "备注", example = "删除按钮功能")
	private String remark;

	@Column(name = "right_name")
	@JsonProperty("right_name")
	@JSONField(name = "right_name")
	@ApiModelProperty(name = "right_name", notes = "q权限名称", example = "删除按钮")
	private String rightName;

	@Column(name = "right_code")
	@JsonProperty("right_code")
	@JSONField(name = "right_code")
	@ApiModelProperty(name = "right_code", notes = "权限编码", example = "delete_code")
	private String rightCode;

	@JsonProperty("url")
	@JSONField(name = "url")
	@ApiModelProperty(name = "url", notes = "功能地址", example = "/deleted")
	private String url;

	@Column(name = "tenant_id")
	@JsonProperty("tenant_id")
	@JSONField(name = "tenant_id")
	@ApiModelProperty(name = "tenant_id", notes = "租户", example = "1")
	private String tenantId;

	@Transient
	@ApiModelProperty(name = "children", notes = "组织子节点信息")
	private List<Function> children = new ArrayList<>();

}
